fix(schedule): stop stray 'days' data from overriding Global schedule#399
Conversation
save_schedule_config never persisted the schedule's 'mode' field, and _check_schedule inferred per-day vs global purely from whether a 'days' dict was present for the current day. Config migration (_merge_template_defaults) re-adds the template's 'schedule.days' (all days disabled by default) whenever it's missing from the user's saved config - which is exactly the case after saving Global mode, since that save path intentionally pops 'days'. The result: a user on Global mode would get their schedule silently reinterpreted as per-day, with today's day disabled, blanking the display. Persist 'mode' on save and have _check_schedule honor it explicitly (mirroring how _check_dim_schedule already does), so a resurrected 'days' dict can't override an explicit Global selection. Falls back to the old inference behavior only when no 'mode' is recorded.
|
Warning Review limit reached
Next review available in: 31 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Summary
Fixes a bug where a display schedule set to "Global" would silently blank the display on certain days, logging that "Saturday wasn't active" even though the user never configured per-day settings.
Root cause
save_schedule_configinweb_interface/blueprints/api_v3.pynever persisted the schedule'smodefield toconfig.json(unlike the dim schedule's save handler, which does)._check_scheduleinsrc/display_controller.pydecided global-vs-per-day purely by checking whether adaysdict happened to be present for the current weekday — it never consultedmode.config_manager._merge_template_defaults(config migration) re-adds any template key missing from the user's saved config, includingschedule.days— which is exactly the key the "Global" save path intentionally removes. So after saving Global mode, the next config load/migration resurrectsschedule.daysfrom the template (all daysenabled: false), and_check_scheduletreats it as authoritative, disabling the display on any day it finds there.Fix
modewhen saving the schedule (mirrors the existing dim-schedule save behavior)._check_schedulehonor an explicitmodefield (mirrors the existing_check_dim_schedulelogic), so a resurrected/straydaysdict can no longer override an explicit Global selection. Falls back to the previous inference-from-days-presence behavior only for legacy configs with no recordedmode.Type of change
Related issues
Reported by a user: Global Schedule would shut off the display, with logs showing "Saturday wasn't active" despite Global mode being selected.
Test plan
EMULATOR=true python3 run.py)scripts/dev_server.py)pytest)Existing
pytestschedule tests could not be executed in this sandbox (missing system deps forRGBMatrixEmulator/freetypehardware stack). Verified the new_check_schedulebranching logic directly with a standalone script covering: global mode with a stray/resurrecteddaysdict (bug repro — now correctly ignored), legacy config with nomode+ per-day match, legacy config with nomode+ day missing (falls back to global), explicit per-day mode, and explicit global mode with nodayskey at all.Documentation
Plugin compatibility
Checklist
config_schema.json) — N/A, no new config key added,modewas already part of the schedule-picker widget's payload.Notes for reviewer
The dim schedule (
dim_schedule) already correctly persists and checksmode, so it was unaffected by this bug — only the primary display schedule was missing this.Generated by Claude Code